﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Kugar.Core.PluginFramework.Common
{
    public class PluginParamter:IReadOnlyDictionary<string,object>
    {
        private List<KeyValuePair<string,object>> _args=new List<KeyValuePair<string, object>>(5);

        public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
        {
            foreach (var pair in _args)
            {
                yield return pair;
            }
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }

        public int Count => _args.Count;

        public bool ContainsKey(string key)
        {
            return _args.Any(x => x.Key == key);
        }

        public bool TryGetValue(string key, out object value)
        {
            throw new NotImplementedException();
        }

        public object this[string key]
        {
            get { throw new NotImplementedException(); }
        }

        public IEnumerable<string> Keys
        {
            get
            {
                foreach (var pair in _args)
                {
                    yield return pair.Key;
                }
            }
        }

        public IEnumerable<object> Values { get; }
    }
}
